/**********************************************************************************************************************
 *
 * Project:    mGameEngine
 * File:       positionalsoundsource.h
 * Author:     twoja stara
 * Created on: 2009-07-16
 *
 **********************************************************************************************************************/

#ifndef POSITIONALSOUNDSOURCE_H_
#define POSITIONALSOUNDSOURCE_H_

#include "ambientsoundsource.h"

namespace mGameEngine
{
namespace Audio
{

/**
 * Positioned omni-directional sound source.
 * It has specified rolloff distances and factors.
 */
class PositionalSoundSource: public AmbientSoundSource
{
protected:
    /**
     * Attenuation reference distance.
     */
    float _refDistance;

    /**
     * Attenuation rolloff factor.
     */
    float _rolloff;

public:
    /**
     * Create positional sound source.
     */
    PositionalSoundSource();

    /**
     * Create positional sound source with specified sound and attenuation.
     * @param sound sound.
     * @param refDistance attenuation reference distance.
     * @param rolloff attenuation rolloff factor.
     */
    PositionalSoundSource(    Sound *sound,
                            float refDistance = 1.0f,
                            float rolloff = 1.0f);

    /**
     * Destroy positional sound source.
     */
    virtual ~PositionalSoundSource();

    /**
     * Get attenuation reference distance.
     * @return attenuation reference distance.
     */
    float getReferenceDistance() const
    {
        return _refDistance;
    }

    /**
     * Set attenuation reference distance.
     * @param refDistance attenuation reference distance.
     */
    void setReferenceDistance(float refDistance)
    {
        _refDistance = refDistance;
    }

    /**
     * Get attenuation rolloff factor
     * @return attenuation rolloff factor.
     */
    float getRolloffFactor() const
    {
        return _rolloff;
    }

    /**
     * Set attenuation rolloff factor.
     * @param rolloff attenutation rolloff factor.
     */
    void setRolloffFactor(float rolloff)
    {
        _rolloff = rolloff;
    }

    /**
     * Set positional sound source.
     */
    virtual void set() const;
};

}
}

#endif // POSITIONALSOUNDSOURCE_H_
